<template>
	<view class="page-wrap" :data-theme="theme" :class="theme" :style="globalColor.style">
		<HeadCustom title="积分记录" :isAppBtn="false" :isHome="false">
			<view slot="right" class="font28" @click="navPage()">积分规则</view>
		</HeadCustom>
		<view class="wrap">
			<view class="record-list">
				<view class="record-item" v-for="(item, index) in dataList" :key="index">
					<view class="fboxRow Ycenter">
						<view class="fboxCol flex1">
							<view class="tit font32 lh44">{{item.sceneDesc}}</view>
							<view class="con mt8 font24 lh34 color-747986">{{item.gmtCreate}}</view>
						</view>
						<view class="btn fboxRow Ycenter Xcenter font32 color-FFD9B5" v-if="item.changeType == 0">+{{item.changePoint}}</view>
						<view class="btn fboxRow Ycenter Xcenter font32 color-747986" v-else>-{{item.changePoint}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { pointLogsList } from '@/api/mine.js';
export default {
	data() {
		return {
			theme: getApp().globalData.appTheme,
			globalColor: getApp().globalData.globalColor,
			page: {
				size: 20,
				current: 1,
				total: 0,
				loading: 'loading'
			},
			pointsNum: 0,
			dataList: []
		};
	},
	onLoad() {
		this.getList();
	},
	onReachBottom() {
		if (this.page.size * this.page.current < this.page.total) {
			this.page.loading = 'loading';
			this.page.current = this.page.current + 1;
			this.getList();
		} else {
			this.page.loading = 'nomore';
		}
	},
	onPullDownRefresh() {
		this.page.current = 1;
		this.page.size = 20;
		this.getList();
	},
	methods: {
		navPage(){
			this.$pageTo('/about/index?settingCode=POINT_RULES');
		},
		getList(){
			pointLogsList(this.page).then(res=>{
				this.dataList = this.dataList.concat(res.data.list)
				this.page.total = res.data.total
			})
		}
	}
};
</script>

<style scoped lang="scss">
.page-wrap{min-height: calc(100vh); background-color: var(--controllerBgColor);}
	.record-list{padding: 0 40rpx;}
	.record-item{padding: 40rpx 0;border-top: 1rpx solid #1E222F;}
	.record-item:first-child{border-top:0;}
	.record-item .btn{margin-left: 40rpx;height: 48rpx;}
	.color-747986{color:#747986 ;}
	.color-FFD9B5{color:#FFD9B5}
</style>
